package uaiContacts.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Droog
 */
@Entity
@Table(name = "tb_lancamento_fincanc", catalog = "sistema_ipi", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LancamentoFincanc.findAll", query = "SELECT l FROM LancamentoFincanc l"),
    @NamedQuery(name = "LancamentoFincanc.findByIdLancamentoFinanc", query = "SELECT l FROM LancamentoFincanc l WHERE l.lancamentoFincancPK.idLancamentoFinanc = :idLancamentoFinanc"),
    @NamedQuery(name = "LancamentoFincanc.findByIdIgreja", query = "SELECT l FROM LancamentoFincanc l WHERE l.lancamentoFincancPK.idIgreja = :idIgreja"),
    @NamedQuery(name = "LancamentoFincanc.findByDscLancamentoFinanc", query = "SELECT l FROM LancamentoFincanc l WHERE l.dscLancamentoFinanc = :dscLancamentoFinanc"),
    @NamedQuery(name = "LancamentoFincanc.findByIndDebCred", query = "SELECT l FROM LancamentoFincanc l WHERE l.indDebCred = :indDebCred"),
    @NamedQuery(name = "LancamentoFincanc.findByDtVencimento", query = "SELECT l FROM LancamentoFincanc l WHERE l.dtVencimento = :dtVencimento"),
    @NamedQuery(name = "LancamentoFincanc.findByIndSituacao", query = "SELECT l FROM LancamentoFincanc l WHERE l.indSituacao = :indSituacao"),
    @NamedQuery(name = "LancamentoFincanc.findByValor", query = "SELECT l FROM LancamentoFincanc l WHERE l.valor = :valor"),
    @NamedQuery(name = "LancamentoFincanc.findByDtLancamento", query = "SELECT l FROM LancamentoFincanc l WHERE l.dtLancamento = :dtLancamento"),
    @NamedQuery(name = "LancamentoFincanc.findByObs", query = "SELECT l FROM LancamentoFincanc l WHERE l.obs = :obs")})
public class LancamentoFincanc implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected LancamentoFincancPK lancamentoFincancPK;
    @Size(max = 40)
    @Column(name = "dsc_lancamento_financ", length = 40)
    private String dscLancamentoFinanc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ind_deb_cred", nullable = false)
    private Character indDebCred;
    @Column(name = "dt_vencimento")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtVencimento;
    @Column(name = "ind_situacao")
    private Character indSituacao;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private double valor;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dt_lancamento", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtLancamento;
    @Size(max = 2147483647)
    @Column(length = 2147483647)
    private String obs;
    @JoinTable(name = "tb_lanc_mov_caixa_mes", joinColumns = {
        @JoinColumn(name = "id_lancamento_financ", referencedColumnName = "id_lancamento_financ", nullable = false),
        @JoinColumn(name = "id_igreja", referencedColumnName = "id_igreja", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "mes_ano", referencedColumnName = "mes_ano", nullable = false)})
    @ManyToMany
    private List<MovimentacaoCaixaMes> movimentacaoCaixaMesList;
    @JoinColumn(name = "id_categoria", referencedColumnName = "id_categoria", nullable = false)
    @ManyToOne(optional = false)
    private Categoria idCategoria;
    @JoinColumn(name = "id_igreja", referencedColumnName = "id_igreja", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private DadosIgreja dadosIgreja;
    @JoinColumn(name = "id_formapagamento", referencedColumnName = "id_formapagamento", nullable = false)
    @ManyToOne(optional = false)
    private FormaPagamento idFormapagamento;
    @JoinColumn(name = "id_membro", referencedColumnName = "id_membro", nullable = false)
    @ManyToOne(optional = false)
    private Membro idMembro;
    @JoinColumn(name = "id_ministerio", referencedColumnName = "id_ministerio", nullable = false)
    @ManyToOne(optional = false)
    private Ministerio idMinisterio;

    public LancamentoFincanc() {
    }

    public LancamentoFincanc(LancamentoFincancPK lancamentoFincancPK) {
        this.lancamentoFincancPK = lancamentoFincancPK;
    }

    public LancamentoFincanc(LancamentoFincancPK lancamentoFincancPK, Character indDebCred, double valor, Date dtLancamento) {
        this.lancamentoFincancPK = lancamentoFincancPK;
        this.indDebCred = indDebCred;
        this.valor = valor;
        this.dtLancamento = dtLancamento;
    }

    public LancamentoFincanc(int idLancamentoFinanc, int idIgreja) {
        this.lancamentoFincancPK = new LancamentoFincancPK(idLancamentoFinanc, idIgreja);
    }

    public LancamentoFincancPK getLancamentoFincancPK() {
        return lancamentoFincancPK;
    }

    public void setLancamentoFincancPK(LancamentoFincancPK lancamentoFincancPK) {
        this.lancamentoFincancPK = lancamentoFincancPK;
    }

    public String getDscLancamentoFinanc() {
        return dscLancamentoFinanc;
    }

    public void setDscLancamentoFinanc(String dscLancamentoFinanc) {
        this.dscLancamentoFinanc = dscLancamentoFinanc;
    }

    public Character getIndDebCred() {
        return indDebCred;
    }

    public void setIndDebCred(Character indDebCred) {
        this.indDebCred = indDebCred;
    }

    public Date getDtVencimento() {
        return dtVencimento;
    }

    public void setDtVencimento(Date dtVencimento) {
        this.dtVencimento = dtVencimento;
    }

    public Character getIndSituacao() {
        return indSituacao;
    }

    public void setIndSituacao(Character indSituacao) {
        this.indSituacao = indSituacao;
    }

    public double getValor() {
        return valor;
    }

    public void setValor(double valor) {
        this.valor = valor;
    }

    public Date getDtLancamento() {
        return dtLancamento;
    }

    public void setDtLancamento(Date dtLancamento) {
        this.dtLancamento = dtLancamento;
    }

    public String getObs() {
        return obs;
    }

    public void setObs(String obs) {
        this.obs = obs;
    }

    @XmlTransient
    public List<MovimentacaoCaixaMes> getMovimentacaoCaixaMesList() {
        return movimentacaoCaixaMesList;
    }

    public void setMovimentacaoCaixaMesList(List<MovimentacaoCaixaMes> movimentacaoCaixaMesList) {
        this.movimentacaoCaixaMesList = movimentacaoCaixaMesList;
    }

    public Categoria getIdCategoria() {
        return idCategoria;
    }

    public void setIdCategoria(Categoria idCategoria) {
        this.idCategoria = idCategoria;
    }

    public DadosIgreja getDadosIgreja() {
        return dadosIgreja;
    }

    public void setDadosIgreja(DadosIgreja dadosIgreja) {
        this.dadosIgreja = dadosIgreja;
    }

    public FormaPagamento getIdFormapagamento() {
        return idFormapagamento;
    }

    public void setIdFormapagamento(FormaPagamento idFormapagamento) {
        this.idFormapagamento = idFormapagamento;
    }

    public Membro getIdMembro() {
        return idMembro;
    }

    public void setIdMembro(Membro idMembro) {
        this.idMembro = idMembro;
    }

    public Ministerio getIdMinisterio() {
        return idMinisterio;
    }

    public void setIdMinisterio(Ministerio idMinisterio) {
        this.idMinisterio = idMinisterio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (lancamentoFincancPK != null ? lancamentoFincancPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LancamentoFincanc)) {
            return false;
        }
        LancamentoFincanc other = (LancamentoFincanc) object;
        if ((this.lancamentoFincancPK == null && other.lancamentoFincancPK != null) || (this.lancamentoFincancPK != null && !this.lancamentoFincancPK.equals(other.lancamentoFincancPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.LancamentoFincanc[ lancamentoFincancPK=" + lancamentoFincancPK + " ]";
    }
    
}